﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace ProjetoFinal
{
    public class GameOver
    {
        Texture2D lost, won;
        int counter;
        SpriteFont font;

        public void LoadContent(ContentManager content)
        {
            lost = content.Load<Texture2D>("youLost");
            won = content.Load<Texture2D>("youWon");
            font = content.Load<SpriteFont>("fontGameOver");
        }   

        public void Update(GameTime gameTime)
        {
            counter++;

            if(counter > 180)
                Manager.nowState = Manager.GameState.Menu;

        }

        public void Draw(SpriteBatch spriteBatch, int score)
        {
            spriteBatch.Begin();
           

            if (Manager.levelNow == 1)
                if (Level1.won == false)
                {
                    spriteBatch.Draw(lost, new Vector2(0, 0), Color.White);
                    spriteBatch.DrawString(font, "Pontuação Final:  " + Level1.score, new Vector2(360, 280), Color.Black);
                }

            if (Manager.levelNow == 2)
                if (Level2.won == false)
                {
                    spriteBatch.Draw(lost, new Vector2(0, 0), Color.White);
                    spriteBatch.DrawString(font, "Pontuação Final:  " + Level1.score, new Vector2(360, 280), Color.Black);
                }

            if (Manager.levelNow == 3)
                if (Level3.won == false)
                {
                    spriteBatch.Draw(lost, new Vector2(0, 0), Color.White);
                    spriteBatch.DrawString(font, "Pontuação Final:  " + Level1.score, new Vector2(360, 280), Color.Black);
                }

                else
                {
                    spriteBatch.Draw(won, new Vector2(0, 0), Color.White);
                    spriteBatch.DrawString(font, "Pontuação Final:  " + Level1.score, new Vector2(340, 380), Color.Black);
                }

            
            spriteBatch.End();
        }

        public void Restart()
        {
            counter = 0;
        }
    }
}
